Telegram Group & Telegram Channel
Динамическая замена class

Многие знают, что с помощью type можно получить тип объекта. Но не все так просто, по сути type служит динамической заменой инструкции class и позволяет создавать новые объекты типа во время исполнения.

Первый принимаемый аргумент является именем класса и становится атрибутом __name__; второй аргумент является кортежем с перечисленными базовыми типами и становится атрибутом __base__; словарь будет являться телом класса и станет атрибутом __dict__.

#type #class



tg-me.com/python_academy/586
Create:
Last Update:

Динамическая замена class

Многие знают, что с помощью type можно получить тип объекта. Но не все так просто, по сути type служит динамической заменой инструкции class и позволяет создавать новые объекты типа во время исполнения.

Первый принимаемый аргумент является именем класса и становится атрибутом __name__; второй аргумент является кортежем с перечисленными базовыми типами и становится атрибутом __base__; словарь будет являться телом класса и станет атрибутом __dict__.

#type #class

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/586

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

The S&P 500 slumped 1.8% on Monday and Tuesday, thanks to China Evergrande, the Chinese property company that looks like it is ready to default on its more-than $300 billion in debt. Cries of the next Lehman Brothers—or maybe the next Silverado?—echoed through the canyons of Wall Street as investors prepared for the worst.

Unlimited members in Telegram group now

Telegram has made it easier for its users to communicate, as it has introduced a feature that allows more than 200,000 users in a group chat. However, if the users in a group chat move past 200,000, it changes into "Broadcast Group", but the feature comes with a restriction. Groups with close to 200k members can be converted to a Broadcast Group that allows unlimited members. Only admins can post in Broadcast Groups, but everyone can read along and participate in group Voice Chats," Telegram added.

Python Academy from pl


Telegram Python Academy
FROM USA